1. Technical Field
The present invention relates to a data processing system. In particular, the present invention relates to supporting shared library text replication in a data processing system. Still more particularly, the present invention relates to a method and apparatus that supports shared library text replication across a fork system call.
2. Description of Related Art
Under most UNIX environments, a system call named fork is provided to replicate a process to create a new process. One of these environments is Portable Operating System Interface (POSIX). POSIX is a standard published by IEEE that describes a UNIX-based system call interface that supports multiple platforms. POSIX system call interface includes a programming model that handles multithreading. A thread is a process or task managed by the kernel or the operating system. When multiple threads are executing at the same time, each thread may execute in another thread's address space.
In POSIX system call interface, a fork system call causes a process to create an exact copy of itself. The fork system call creates a new process called a child process. The original process is called a parent process. The child process has its own process identifier and address space. Thus, using the fork system call, an application may create copies of executable program code in many different physical memory locations at the same time. The replication of executable program code is known as text replication.
Text replication may not be difficult to implement in applications that have no shared state between a parent and a child process. The child and parent processes may each have its own address space, which allows the text addresses to be different in the parent and the child. Many applications use exec system call immediately after the fork system call, which loads a new program code, instead of using the fork system call to provide an alternative mechanism for replicated text.
However, text replication may be difficult to implement in applications that require data sharing between parent and child processes. An example of these applications includes DB2 Universal Database, a product available from International Business Machines Corporation. These applications often use fork system calls to instantiate their work. The use of fork system calls requires each child and parent process to have the same effective or program addresses, while each replicated shared library may be optimized to have different physical addresses local to the shared library's affinity domain. An affinity or memory domain is a group of processors and a region of memory that is local to the group of processors and is most efficiently accessed by the group of processors.
Furthermore, the shared libraries are accessed globally by different applications and programs on the system. Therefore, it would be advantageous to have a mechanism that can transparently replicate text or shared library code for new processes created by the fork system call.